package com.mp.approvalreq.dao;

import com.mp.approvalreq.entity.*;
import com.mp.approvalreq.entity.dto.*;
import com.mp.user.entity.User;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 审批的查询Dao
 *
 * @author xq
 */
public interface SelectApprovalDao {

	/**
	 * 获取该用户申请过的指定类型，指定状态的审批列表
	 *
	 * @param companyInfoId
	 * @param templateType
	 * @param finished
	 * @return
	 * @throws SQLException
	 */
	List<Request> selectRequestListByTemplateType(Integer companyInfoId, Integer templateType, String finished) throws SQLException;

	/**
	 * 获取用户申请的调休审批
	 *
	 * @param companyInfoId
	 * @return
	 * @throws SQLException
	 */
	List<DaysOffTimeInfo> selectDaysOffRequestList(Integer companyInfoId) throws SQLException;

	/**
	 * 获取审批详情
	 *
	 * @param requestId
	 * @return
	 * @throws SQLException
	 */
	RequestInfoDTO getRequestInfoDTO(Integer requestId) throws SQLException;

	/**
	 * 获取审批的加班时长
	 *
	 * @param requestIds
	 * @return
	 * @throws SQLException
	 */
	List<RequestTime> selectRequestTimeList(List<Integer> requestIds) throws SQLException;

	List<RequestTime> selectAllRequestTime(Integer requestId) throws SQLException;

	/**
	 * 获取我申请的指定日期之后的请假审批
	 *
	 * @param companyInfoId
	 * @return
	 * @throws SQLException
	 */
	List<RequestInfoDTO> selectLeaveTimeRequestsByGeneration(Integer companyInfoId, Integer generation) throws SQLException;

	/**
	 * 获取审批详情信息
	 *
	 * @param requestId
	 * @param companyId
	 * @return
	 * @throws SQLException
	 */
	RequestInfoDTO getRequestInfoDTO(Integer requestId, Integer companyId) throws SQLException;

	/**
	 * 获取审批详情
	 *
	 * @return
	 * @throws SQLException
	 */
	RequestDTO getRequestDetail(Integer companyId, Integer requestId) throws SQLException;

	/**
	 * 获取某月份的支出总额
	 *
	 * @param companyId
	 * @param month
	 * @param templateIds
	 * @return
	 * @throws SQLException
	 */
	List<RequestInfoDTO> getApprovalsCostByMonth(Integer companyId, String month, List<Integer> templateIds) throws SQLException;

	/**
	 * 获取公司的通用审批流
	 *
	 * @param companyId
	 * @return
	 * @throws SQLException
	 */
	List<GeneralRequestDTO> getProjectGeneralRequestFlows(Integer companyId, List<Integer> projectIds) throws SQLException;

	/**
	 * 获取通用审批流中的条件审批流
	 *
	 * @param companyId
	 * @return
	 * @throws SQLException
	 */
	Map<Integer, List<GeneralConditionFlowDTO>> getGeneralConditionFlowDTOs(Integer companyId, List<Integer> generalConditionFlowIdList) throws SQLException;

	List<RequestInfoDTO> getNeedApprovalList(Integer companyId, Integer companyInfoId) throws SQLException;

	/**
	 * 获取我所有已审批的加班审批
	 *
	 * @param companyInfoId
	 * @return
	 * @throws SQLException
	 */
	List<RequestInfoDTO> getOverWorkTimeRequests(Integer companyInfoId) throws SQLException;

	List<ApprovalCost> getCostApprovals(Integer companyId, String requestIds) throws SQLException;

	/**
	 * 获取某用户的调休审批
	 *
	 * @param companyInfoId
	 * @return
	 * @throws SQLException
	 */
	List<RequestInfoDTO> selectDaysOffRequests(Integer companyInfoId) throws SQLException;

	/**
	 * 根据id获取审批批准状态
	 *
	 * @param id
	 * @return
	 * @throws SQLException
	 */
	Integer selectRequestNewestStatus(Integer id) throws SQLException;

}
